{template '_header'}
<style type="text/css">
    .multi-img-details .multi-item img{height:100px;}
</style>
<div class="page-heading">
    <span class='pull-right'>
        {ifp 'sale.goodscode.add'}
        	<a class='btn btn-primary btn-sm' href="{php echo webUrl('sale/goodscode/add')}"><i class='fa fa-plus'></i> 添加商品</a>
        {/if}
        <a class="btn btn-default  btn-sm" href="{php echo webUrl('sale/goodscode')}">返回列表</a>
    </span>
    <h2>{if !empty($item['id'])}编辑{else}添加{/if}商品 <small>{if !empty($item['id'])}修改【{$item['title']}】{/if}</small></h2>
</div>


<form {ife 'sale.goodscode' $item}action="" method="post"{/if} class="form-horizontal form-validate" enctype="multipart/form-data">
    <input type="hidden" name="id" value="{$item['id']}" />
        <div class="tab-content ">
            <div class="tab-pane active">
                <div class="panel-body">

                    <div class="form-group">
                        <label class="col-sm-2 control-label">排序</label>
                        <div class="col-sm-9 col-xs-12">
                            {ife 'sale.goodscode' $item}
                            <input type='text' class='form-control' name='displayorder' value="{$item['displayorder']}" />
                            <span class="help-block">数字越大，排名越靠前,如果为空，默认排序方式为创建时间</span>
                            {else}
                            <div class='form-control-static'>{$item['displayorder']}</div>
                            {/if}
                        </div>
                    </div>

                    <div class="form-group" id="product">
                        <label class="col-sm-2 control-label">选择商品</label>
                        <div class="col-sm-9 col-xs-12">
                            {ife 'sale.goodscode' $item}
                            <?php echo tpl_selector('goodsid',
                        array(
                            'type'=>'image',
                            'placeholder'=>'指定商品名称',
                            'buttontext'=>'选择商品',
                            'items'=>$goods,
                            'nokeywords'=>1,
                            'autosearch'=>1,
                            'url'=>webUrl('sale/goodscode/query')))?>
                            {else}
                            <a href='{php echo tomedia($item["thumb"])}' target='_blank'>
                                <img src="{php echo tomedia($item['thumb'])}" style='height:100px;border:1px solid #ccc;padding:1px;float:left;margin-right:5px;' />
                            </a>
                            {/if}
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-xs-12 col-sm-3 col-md-2 col-lg-2 control-label">状态</label>
                        <div class="col-xs-12 col-sm-8">
                            <div class="input-group">
                                {ife 'sale.goodscode' $item}
                                <label class="radio radio-inline">
                                    <input type="radio" name="status" value="0" {if intval($item['status']) ==0}checked="checked"{/if}> 关闭
                                </label>
                                <label class="radio radio-inline">
                                    <input type="radio" name="status" value="1" {if intval($item['status']) ==1 }checked="checked"{/if}> 开启
                                </label>
                                {else}
                                <div class='form-control-static'>{if intval($item['status']) ==1 }开启{else}关闭{/if}</div>
                                {/if}
                            </div>
                        </div>
                    </div>

                </div>
            </div>

        </div>

{ife 'sale.goodscode' $item}
<div class="form-group">
    <label class="col-sm-2 control-label"></label>
    <div class="col-sm-9 col-xs-12">
        <input type="submit"  value="提交" class="btn btn-primary" />
    </div>
</div>
{/if}

</form>

{template '_footer'}